import ajax from './index'

export function product_list(condition) {
  if (!condition) {
    condition = {
      pageNum: 1,
      pageSize: 20
    }
  }
  return ajax({
    url: "/pms/product/list",
    method: "get",
    params: condition
  });
}

export function product_save(param) {
  return ajax({
    url: "/pms/product/save",
    method: "post",
    data: param
  });
}
export function product_detail(id) {
  return ajax({
    url: "/pms/product/detail" + "/" + id,
    method: "get"
  });
}
export function product_delete(id) {
  return ajax({
    url: "/pms/product/delete",
    method: "post",
    data: {
      id: id
    }
  });
}
export function product_submit(id) {
  return ajax({
    url: "/pms/product/submit" + "/" + id,
    method: "post"
  });
}

// export function product_alibaba_detail(id) {
//     return ajax({
//         url: "/pms/product/alibaba_detail" + "/" + id,
//         method: "get"
//     });
// }
export function product_alibaba_detail(id) {
  return ajax({
    url: "/pms/alibaba/productDetails" + "/" + id,
    method: "get"
  });
}
export function product_jd_detail(id) {
  return ajax({
    url: "/pms/product/jd_detail" + "/" + id,
    method: "get"
  });
}

export function product_update_order(param) {
  return ajax({
    url: "/pms/product/update_order",
    method: "post",
    data: param
  });
}

export function product_update_stock(param) {
  return ajax({
    url: "/pms/product/update_stock",
    method: "post",
    data: param
  });
}

export function product_up(param) {
  return ajax({
    url: "/pms/product/up",
    method: "post",
    data: param
  });
}

export function product_down(param) {
  return ajax({
    url: "/pms/product/down",
    method: "post",
    data: param
  });
}

export function product_cate_nums() {
  return ajax({
    url: "/pms/product/cate_nums",
    method: "get"
  });
}
export function product_sale_count() {
  return ajax({
    url: "/pms/product/sale_count",
    method: "get"
  });
}

export function product_category_history() {
  return ajax({
    url: "/pms/product/categoryHistory",
    method: "get"
  });
}
export function productExport(query) {
  return ajax({
    url: '/pms/product/export',
    method: 'get',
    params: query
  });
}

export function product_sync() {
  return ajax({
    url: "/pms/product/sync",
    method: "get"
  });
}
